/*  1:   */ package org.intellij.plugins.relaxNG.compact.psi.impl;
/*  2:   */ 
/*  3:   */

import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiReference;
import com.intellij.psi.util.PsiTreeUtil;
import org.intellij.plugins.relaxNG.compact.psi.RncElementVisitor;
import org.intellij.plugins.relaxNG.compact.psi.RncGrammar;
import org.intellij.plugins.relaxNG.compact.psi.RncParentRef;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */ 
/* 16:   */ public class RncParentRefImpl
/* 17:   */   extends RncRefImpl
/* 18:   */   implements RncParentRef
/* 19:   */ {
/* 20:   */   public RncParentRefImpl(ASTNode paramASTNode)
/* 21:   */   {
/* 22:37 */     super(paramASTNode);
/* 23:   */   }
/* 24:   */   
/* 25:   */   public String getReferencedName()
/* 26:   */   {
/* 27:42 */     ASTNode localASTNode = findNameNode();
/* 28:43 */     return localASTNode == null ? null : super.getReferencedName();
/* 29:   */   }
/* 30:   */   
/* 31:   */   public void accept(@NotNull RncElementVisitor paramRncElementVisitor)
/* 32:   */   {
/* 33:48 */     if (paramRncElementVisitor == null) {
/* 34:48 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/plugins/relaxNG/compact/psi/impl/RncParentRefImpl", "accept" }));
/* 35:   */     }
/* 36:48 */     paramRncElementVisitor.visitParentRef(this);
/* 37:   */   }
/* 38:   */   
/* 39:   */   public int getTextOffset()
/* 40:   */   {
/* 41:53 */     ASTNode localASTNode = findNameNode();
/* 42:54 */     return localASTNode != null ? localASTNode.getStartOffset() : getTextRange().getStartOffset();
/* 43:   */   }
/* 44:   */   
/* 45:   */   @Nullable
/* 46:   */   public PsiReference getReference()
/* 47:   */   {
/* 48:60 */     new PatternReference(this)
/* 49:   */     {
/* 50:   */       protected RncGrammar getScope()
/* 51:   */       {
/* 52:63 */         PsiElement localPsiElement = PsiTreeUtil.getParentOfType(getElement(), RncGrammar.class, true, new Class[] { PsiFile.class });
/* 53:64 */         if (localPsiElement == null) {
/* 54:65 */           return null;
/* 55:   */         }
/* 56:67 */         return (RncGrammar)PsiTreeUtil.getParentOfType(localPsiElement, RncGrammar.class, true, new Class[] { PsiFile.class });
/* 57:   */       }
/* 58:   */     };
/* 59:   */   }
/* 60:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.compact.psi.impl.RncParentRefImpl

 * JD-Core Version:    0.7.0.1

 */